home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / pascal / tgraph.com / DEMO.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1991-01-04  |  1.5 KB  |  57 lines

  1. Program DEMO;
  2. {a demonstration of TGRAPH usage for Tandy 1000 mode 9 graphics}
  3.  
  4. {$m 8000,0,0}        { Limiting stack and heap size with this    }
  5.                      { compiler directive takes care of          }
  6.                      { protecting screen memory area.            }
  7.  
  8.  
  9. {install the correct TPU depending on which TP version you're using}
  10. {$IFDEF VER40} Uses TGraph40,Crt; {$ENDIF}
  11. {$IFDEF VER50} Uses TGraph50,Crt; {$ENDIF}
  12. {$IFDEF VER55} Uses TGraph55,Crt; {$ENDIF}
  13. {$IFDEF VER60} Uses TGraph60,Crt; {$ENDIF}
  14.  
  15. Var k:integer;
  16.     ch:char;
  17.     PicBuff:array [1..1000] of byte;   {just an estimate of size needed}
  18.  
  19. Begin
  20. Randomize;
  21.  
  22. SetCrtMode (9,true);
  23.  
  24. {Draw a bunch of diagonal lines in random colors}
  25. For k := 1 to 20 do Draw (k*5,1,k*5+80,199,Random(15)+1);
  26.  
  27. {Make three circles}
  28. Circle (250,50,20,Green);
  29. Circle (250,100,20,Red);
  30. Circle (250,150,20,Yellow);
  31.  
  32. {Paint the circles with random colors}
  33. Paint (250,50,Random(15)+1,Green);
  34. Paint (250,100,Random(15)+1,Red);
  35. Paint (250,150,Random(15)+1,Yellow);
  36.  
  37. {Recolor everything on the screen randomly}
  38. Repeat Recolor (Random(15)+1,Random(15)+1);
  39. Until Keypressed;
  40. Ch := ReadKey;
  41.  
  42. {Do a GetPic of a section of the diagonal lines
  43.  and PutPic it on top of the center circle}
  44. GetPic (PicBuff,75,80,115,120);
  45. PutPic (PicBuff,230,80);
  46.  
  47. {A PutPix on top of the original source of the
  48.  image effectively erases the image}
  49. PutPix (PicBuff,75,80);
  50.  
  51. Repeat Until Keypressed;
  52. Ch := ReadKey;
  53.  
  54. SetCrtMode (3,true);
  55. End.
  56. 
  57.